#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

#define REP(i, x, y) for (auto i = (x), _##i = (y); i < _##i; ++i)
#define PER(i, x, y) for (auto i = (x), _##i = (y); i > _##i; --i)

template<class T=int>
inline void OO(const T &coll, const char *del = ",") {
    copy(coll.begin(), coll.end(), ostream_iterator<decltype(*coll.begin())>(cerr, del));
    cerr << endl;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    for (int a, b, c, d, e; cin >> a >> b >> c >> d >> e;) {
        vector<int> v{a, b, c, d, e};
        sort(v.begin(), v.end());
        int best = INT_MIN;
        do {
            int cur = (v[0] * 100 + v[1] * 10 + v[2]) * (v[3] * 10 + v[4]);
            best = max(cur, best);
        } while (next_permutation(v.begin(), v.end()));
        cout << best << endl;
    }
    return 0;
}